package git.soulbgm.mapreduce.outputformat;

import git.soulbgm.mapreduce.utils.DriverUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;

import java.io.IOException;


/**
 * @author SoulBGM
 * @date 2021/11/29 0:18
 */
public class LogDriver {

    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        Job job = DriverUtil.createJob(LogDriver.class, LogMapper.class, LogReducer.class,
                Text.class, NullWritable.class, Text.class, NullWritable.class,
                new Path(args[0]), new Path(args[1]));

        job.setOutputFormatClass(LogOutputFormat.class);

        // 7 提交job
        boolean result = job.waitForCompletion(true);
        System.exit(result ? 0 : 1);
    }

}
